package com.ytec.jdap.common;

import java.util.Comparator;

import com.ytec.jdap.model.Application;

public class AppComparetor implements Comparator<Application> {
	
	public int compare(Application app1, Application app2) {
		String order1 = app1.getOrder();
		String order2 = app2.getOrder();
		if(StringUtil.isBlank(order1)&&StringUtil.isBlank(order2))
			return 0;
		if(StringUtil.isNotBlank(order1) && StringUtil.isBlank(order2))
			return 1;
		if(StringUtil.isBlank(order1) && StringUtil.isNotBlank(order2))
			return -1;
		if(Integer.valueOf(order1) > Integer.valueOf(order2))
			return 1;
		if(Integer.valueOf(order1) < Integer.valueOf(order2))
			return -1;
		return 0;
	}
}
